package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFillInsert;
import com.sky.annotation.AutoFillUpdate;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * CategoryMapper
 *
 * @author liliudong
 * @version 1.0
 * @description
 * @date 2023/7/27 20:34
 */
@Mapper
public interface CategoryMapper {
    /**
     * 插入
     *
     * @param category 类别
     */
    @AutoFillInsert
    void insert(Category category);

    /**
     * 选择页面
     *
     * @param category 类别
     * @return {@link Page}<{@link Category}>
     */
    Page<Category> selectPage(Category category);

    /**
     * 更新通过id
     *
     * @param category 类别
     */
    @AutoFillUpdate
    void updateById(Category category);

    /**
     * 删除通过id
     *
     * @param id id
     */
    @Delete("delete from category where id = #{id}")
    void deleteById(Long id);

    /**
     * 选择列表
     *
     * @param category 类别
     * @return
     */
    List<Category> selectList(Category category);
}
